package buisness_service;

import java.util.ArrayList;
import java.util.List;

public class User {

	private int id;
	private String login;
	private String password;
	private String nom;
	private List<Depense> depenses;
	private List<Revenu> revenus;
	private List<Finance_annee> rapport;
	private Economie economie;
	

	public User() {
		Rapport.nbUser++;
		this.setId(Rapport.nbUser);
		depenses = new ArrayList<Depense>();
		revenus = new ArrayList<Revenu>();
		economie = new Economie(this);
setRapport(new ArrayList<Finance_annee>());
		
	}

	public User(String nom, String login, String passord) {
		Rapport.nbUser++;
		this.setId(Rapport.nbUser);
		this.setNom(nom);
		this.setLogin(login);
		this.setPassword(passord);
		depenses = new ArrayList<Depense>();
		revenus = new ArrayList<Revenu>();
		economie = new Economie(this);
		setRapport(new ArrayList<Finance_annee>());
		
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public List<Depense> getDepenses() {
		return depenses;
	}

	public void setDepenses(List<Depense> depenses) {
		this.depenses = depenses;
	}

	public List<Revenu> getRevenus() {
		return revenus;
	}

	public void setRevenus(List<Revenu> revenus) {
		this.revenus = revenus;
	}

	public Economie getEconomie() {
		return economie;
	}

	public void setEconomie(Economie economie) {
		this.economie = economie;
	}

	public void addDepense(Depense depense) {

		this.depenses.add(depense);

		this.economie.setMontant(Common_methods.Epargne(this.depenses,
				this.revenus));
	}

	public void addRevenu(Revenu revenu) {
		this.revenus.add(revenu);

		this.economie.setMontant(Common_methods.Epargne(this.depenses,
				this.revenus));
	}

	public void removeDepense(int i) {
		this.depenses.remove(i);

		this.economie.setMontant(Common_methods.Epargne(this.depenses,
				this.revenus));

	}

	public void removeRevenu(int i) {
		this.revenus.remove(i);

		this.economie.setMontant(Common_methods.Epargne(this.depenses,
				this.revenus));

	}

	public List<Finance_annee> getRapport() {
		return rapport;
	}

	public void setRapport(List<Finance_annee> rapport) {
		this.rapport = rapport;
	}

	
}
